package jm.algorithm.sort;

/**
 * @Description 冒泡排序
 * @date 2022/5/1 14:35
 */
public class BubbleSort<T extends Comparable<T>> extends Sort<T> {
    @Override
    protected void sort() {
        for (int end = arr.length - 1; end > 0; end--) {
            for (int begin = 1; begin <= end; begin++) {
                if (cmp(begin,begin - 1) < 0){
                    swap(begin,begin - 1);
                }
            }
        }
    }
}
